<template>

  <div class="dv2" @click="showAll()">
    <van-col :span="4">
      <van-image
          width="20rem"
          height="20rem"
          :src="imgUrl"
      />
    </van-col>
    中文名字：{{ chineseName }}
    游记篇数：{{num}}
    英文名字：{{englishName}}
  </div>
</template>

<script>
export default {
  name: "SelectCityByName",
  data(){
    return{
      chineseName:null,
      imgUrl:null,
      englishName:null,
      num:0
    }

  },

  mounted() {
    this.chineseName=this.$route.query.chineseName
    this.englishName=this.$route.query.englishName
    this.imgUrl=this.$route.query.imgUrl
    this.num=this.$route.query.num
  },

methods:{
  showAll(){
    this.axios.get("http://localhost:8082/api/city/selectIdByName.do?name="+this.englishName).then((t)=>{

      //获取id
      this.id=t.data.data;

      //通过id获取笔记详情
      this.axios.get("http://localhost:8082/api/city/showAll.do?id="+this.id).then((r)=>{
        console.log(r.data.data);
        this.$store.commit("setAll",r);
        console.log(this.$store.state.att);
        this.$router.push("/attByCity");
      })
    })
  },
  }
}
</script>

<style scoped>

</style>